package com.greenhouse.mapper.greenhouse;

import com.greenhouse.model.CropInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CropInfoMapper {
    @Insert("insert into crop_info " +
            "(user_id,crop_name, variety,temperature,humidity,soil_moisture,light_intensity,co2,ph,create_time)" +
            "values " +
            "(#{userId},#{cropName},#{variety},#{temperature},#{humidity},#{soilModifier},#{lightIntensity},#{co2},#{ph},NOW())")
    Integer insertCropInfo(CropInfo cropInfo);

    List<CropInfo> getCropInfoList();

    @Delete("delete from crop_info where id = #{id}")
    Integer deleteCrop(Integer id);

    Integer updateCropInfo(CropInfo cropInfo);
}
